package com.xc.freeapp.account.controller;

import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import com.wordnik.swagger.annotations.Api;
import com.wordnik.swagger.annotations.ApiOperation;
import com.xc.freeapp.exception.BaseException;
import com.xc.freeapp.service.DrugdetailService;
import com.xc.freeapp.util.TokenAnnotation;
/**
 * 医药库controller
 * @author ZhouXinjie
 */
@Controller
@RequestMapping("/drug")
@Api(value="/drug" ,description = "医药库")
public class DrugDetailController extends AbstractController{

	@Autowired
	private  DrugdetailService drugdetailService;
	/**
	 * 根据药品id获取药品详情
	 * @param id
	*/
	@TokenAnnotation(required=false)
	@RequestMapping(value = "{id}", method = RequestMethod.GET)
	@ResponseBody 
	@ApiOperation(value = "根据药品id获取药品详情")
	public Map<String, Object> getPossibleDiseases(@PathVariable("id") String id) throws BaseException{

		Map<String, Object> map = drugdetailService.getList(id);
		return map;
	}
	
//	/**
//	 * 获取药品库列表
//	*/
//	@RequestMapping(value = "/getDrugList", method = RequestMethod.GET)
//	@ApiOperation(value = "获取药品库列表")
//	@ApiIgnore
//	@ResponseBody
//	public  ResponseStructBean getDrugList(WebRequest request) throws BaseException{
//		AuthInfo authInfo = AuthUtil.getAuthInfo(getRequest());
//		String strData = request.getParameter("_data");
////		String strData = "{\"reqHead\":{\"businessId\":\"12\",\"userId\":\"1\",\"registrationId\":\"user90000\",\"registerType\":\"1\"},"
////				+ "\"reqBody\":{\"content\":{\"id\":\"1835119\"}}}";
//        RequestStructBean requestStructBean = (RequestStructBean) JsonUtil.parseJson(strData, RequestStructBean.class);
//        CheckUtils.notNull(Constant.VER_NOTNULL, requestStructBean);
//        String userid = requestStructBean.getReqHead().getUserId();
//        System.out.println("用户ID："+userid);
//        String content = requestStructBean.getReqBody().getContent();
//        System.out.println("主数据："+content);
//       /* String id = JsonUtil.getByKey(content, "id");//药品id
//        CheckUtils.notBlankByName(Constant.VER_NOTNULL_BYNAME, id, "药品id");
//		Map<String, Object> map = drugdetailService.getList(id);
//		return ResponseStructBean.getSuccess(map, "Drugdetail");*/
//        return ResponseStructBean.getSuccess();
//	}
	
	
}
